const mongoose = require("mongoose");
const moment = require("moment");
const Db = require("./api/Db")
// 结构约束规则
const schema = new mongoose.Schema({
	// 微博内容
	context: {
		type: String,
		required: true,
		unique: true
	},
	// 顶的数量
	topNum: {
		type: Number,
		default: 0
	},
	// 踩的数量
	downNum: {
		type: Number,
		default: 0
	},
	// 增加的时间
	addTime: {
		type: String
	}
}, {
	versionKey: false
})
// model
const model = mongoose.model("contextList", schema, "contextList");
const obj = new Db(model);
obj.insertOne({
	context:"123",
	addTime:moment().format("YYYY-MM-DD HH:mm:ss")
}).then(value=>{
	console.log("添加成功",value)
})
